﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jim.K3Cloud;

/// <summary>
/// 批量查询
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery", "批量查询")]
public class K3CloudExecuteBillQueryRequest : ISdkRequest<K3CloudExecuteBillQueryResponse>,IK3CloudCustomRequest
{
    /// <summary>
    /// 业务对象表单Id
    /// </summary> 
    [Required(ErrorMessage = "业务对象表单Id不能为空")]
    public string FormId { get; set; }
    /// <summary>
    /// 需查询的字段key集合，字符串类型，格式："key1,key2,..."（必录） 注（查询单据体内码,需加单据体Key和下划线,如：FEntryKey_FEntryId）
    /// </summary>
    [Required(ErrorMessage = "查询字段不能为空")]
    public string FieldKeys { get; set; }
    /// <summary>
    /// 过滤条件，数组类型，如：[{"Left":"(","FieldName":"Field1","Compare":"=","Value":"111","Right":")","Logic":"AND"},{"Left":"(","FieldName":"Field2","Compare":"=","Value":"222","Right":")","Logic":""}]
    /// </summary>
    public string FilterString { get; set; } = "";
    /// <summary>
    /// 排序字段，字符串类型（非必录）
    /// </summary>
    public string OrderString { get; set; } = "";
    /// <summary>
    /// 返回总行数，整型，默认10
    /// </summary>
    public int TopRowCount { get; set; } = 10;
    /// <summary>
    /// 开始行索引，整型，默认0
    /// </summary>
    public int StartRow { get; set; } = 0;
    /// <summary>
    /// 最大行数，整型，不能超过10000，默认2000
    /// </summary>
    public int Limit { get; set; } = 2000;
    /// <summary>
    /// 表单所在的子系统内码，字符串类型（非必录）
    /// </summary>
    public string SubSystemId { get; set; } = "";

    public void Validate()
    {
    }

    public object QueryParams()
    {
        return new { 
            Data = new
            {
                FormId = FormId,
                FieldKeys = FieldKeys,
                FilterString = FilterString,
                OrderString = OrderString,
                TopRowCount = TopRowCount,
                StartRow = StartRow,
                Limit = Limit,
                SubSystemId = SubSystemId,
            }
        };
    }
}

public class K3CloudExecuteBillQueryResponse : SdkResponse<List<Dictionary<string, object>>>
{
}